home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 3.2 KB | 150 lines | [TEXT/CWIE] |
- // SubWindowFocus.cp
-
- #ifndef SubWindowFocus_h
- #include "SubWindowFocus.h"
- #endif
-
- SubWindowFocus::SubWindowFocus( WindowFocus& window, AtStart )
- : Enableable( true ),
- link( this ),
- siblings( window.subFoci ),
- tabber( window, *this )
- {
- window.subFoci.Add( link, beforeStart );
- }
-
- SubWindowFocus::SubWindowFocus( WindowFocus& window, AtEnd )
- : Enableable( true ),
- link( this ),
- siblings( window.subFoci ),
- tabber( window, *this )
- {
- window.subFoci.Add( link, afterEnd );
- }
-
- SubWindowFocus::SubWindowFocus( WindowFocus& window,
- Before,
- SubWindowFocus& sibling )
- : Enableable( true ),
- link( this ),
- siblings( window.subFoci ),
- tabber( window, *this )
- {
- window.subFoci.Add( link, before, sibling.link );
- }
-
- SubWindowFocus::SubWindowFocus( WindowFocus& window,
- After,
- SubWindowFocus& sibling )
- : Enableable( true ),
- link( this ),
- siblings( window.subFoci ),
- tabber( window, *this )
- {
- window.subFoci.Add( link, after, sibling.link );
- }
-
- SubWindowFocus::SubWindowFocus( WindowFocus& window,
- TabKeys& tabHandler,
- AtStart )
- : Enableable( true ),
- link( this ),
- siblings( window.subFoci ),
- tabber( window, tabHandler )
- {
- window.subFoci.Add( link, beforeStart );
- }
-
- SubWindowFocus::SubWindowFocus( WindowFocus& window,
- TabKeys& tabHandler,
- AtEnd )
- : Enableable( true ),
- link( this ),
- siblings( window.subFoci ),
- tabber( window, tabHandler )
- {
- window.subFoci.Add( link, afterEnd );
- }
-
- SubWindowFocus::SubWindowFocus( WindowFocus& window,
- TabKeys& tabHandler,
- Before,
- SubWindowFocus& sibling )
- : Enableable( true ),
- link( this ),
- siblings( window.subFoci ),
- tabber( window, tabHandler )
- {
- window.subFoci.Add( link, before, sibling.link );
- }
-
- SubWindowFocus::SubWindowFocus( WindowFocus& window,
- TabKeys& tabHandler,
- After,
- SubWindowFocus& sibling )
- : Enableable( true ),
- link( this ),
- siblings( window.subFoci ),
- tabber( window, tabHandler )
- {
- window.subFoci.Add( link, after, sibling.link );
- }
-
- void SubWindowFocus::TabForward()
- {
- for ( const ListLink<SubWindowFocus> *p = link.Next();
- p != 0;
- p = p->Next() )
- if ( (*p)->Enabled() )
- {
- Parent()->FavorChild( **p );
- return;
- }
-
- for ( const ListLink<SubWindowFocus> *p = siblings.First();
- p != &link;
- p = p->Next() )
- if ( (*p)->Enabled() )
- {
- Parent()->FavorChild( **p );
- return;
- }
- }
-
- void SubWindowFocus::TabBackward()
- {
- for ( const ListLink<SubWindowFocus> *p = link.Previous();
- p != 0;
- p = p->Previous() )
- if ( (*p)->Enabled() )
- {
- Parent()->FavorChild( **p );
- return;
- }
-
- for ( const ListLink<SubWindowFocus> *p = siblings.Last();
- p != &link;
- p = p->Previous() )
- if ( (*p)->Enabled() )
- {
- Parent()->FavorChild( **p );
- return;
- }
- }
-
- void SubWindowFocus::BeEnabled()
- {
- if ( Parent()->FavoredChild() == 0 )
- Parent()->FavorChild( *this );
- }
-
- void SubWindowFocus::BeDisabled()
- {
- if ( Parent()->FavoredChild() == this )
- {
- TabForward();
- if ( Parent()->FavoredChild() == this )
- Parent()->FavorNoChild();
- }
- }
-